import dayjs from 'dayjs';
import { downLoad, request } from '../../../request';

/** 获取当前温湿度 */
export function getStashTemperatureHumidness(params: any) {
  return request({
    url: '/qms/agv/temperatureHumidity/findTest',
    method: 'get',
    params
  });
}

/** 获取图表温度数据 */
export function getTemperatureHumidityData(params: any) {
  return request({
    url: '/qms/agv/temperatureHumidity/findTreeArr',
    method: 'get',
    params
  });
}

/** 温湿度确认 */
export function getStashTemperatureHumidnessByPage(data: any) {
  return request({
    url: '/qms/agv/temperatureHumidity/check',
    method: 'post',
    data
  });
}

/** 导出 */
export function exportStashTemperatureHumidness(params: any) {
  return downLoad({
    url: '/qms/agv/temperatureHumidity/exportExcel',
    method: 'get',
    params,
    fileName: `温湿度记录表导出${dayjs().format('YYYY-MM-DD HH:mm:ss')}.xlsx`
  });
}

/** 修改温湿度 */

export function updateStashTemperatureHumidness(data: any) {
  return request({
    url: '/qms/agv/temperatureHumidity/updateByDate',
    method: 'post',
    data
  });
}
